<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>ATM取款机</title>
	</head>
	<body>
		<input id="d1" placeholder="账号" />
		<input id="d2" placeholder="密码" />
		<input id="d3" placeholder="取款金额" />
		<input type="button" value="取款" onclick="getmoney()" />
		<script>
		var rightAcount = "1234567";
		var rightPwd = "34343434";
		var acountmoney = 1234;
		var getmoney = function(){
			quqian(d1.value,d2.value,d3.value);
		};
		function quqian(account,pwd,money){
			if(account != rightAcount){
				alert("输入的账号有误！");
				return;
			}
			if(pwd != rightPwd){
				alert("输入的密码有误");
				return;
			}
			if(acountmoney<money){
				alert("余额不足！");
				return;
			}
			if(money.length == 0){
				alert("请输入正确的取款金额！");
				return;
			}
			if(isNaN(money)){
				alert("请 您输入正确的取款金额！");
				return;
			}
			acountmoney = acountmoney - money;
			alert("取款成功！您余额还剩:"+acountmoney);
		};</script>
	</body>
</html>
